home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / WebObjects / WebObjectsDoc_HTML / DynamicElements / FormEx1.wo / FormEx1.wos < prev   
Encoding:
Text File  |  1996-01-28  |  2.4 KB  |  80 lines

  1. id checkBoxChecked;         // WOCheckBox variable
  2. id objectList;              // WOPopUpButton variables
  3. id anObject;
  4. id selectedPopUpButton;
  5. id selectedBrowserItems;    // WOBrowser variable -- an array
  6.                             // We use WOPopUpButton's 'objectList, and  
  7.                 //  'anObject'
  8. id hiddenFieldValue;        // WOHiddenField variable
  9. id textFieldValue;          // WOTextField variable
  10. id passwordFieldValue;      // WOPasswordField variable
  11. id textValue;               // WOTextField variable
  12.  
  13.  
  14. // This method initializes the values for the input elements
  15. - awake {
  16.  
  17.     if (!checkBoxChecked) {
  18.     checkBoxChecked = YES;
  19.     }
  20.  
  21.     // Array of strings for WOPopUpButton and WOBrowser
  22.     objectList = @("item1","item2","item3", "item4", "item5");
  23.     if (!anObject ) {
  24.     anObject = @"";
  25.     }
  26.  
  27.     if (!selectedPopUpButton) {        // on return, selectedPopUpButton stores
  28.     selectedPopUpButton = @"item2";  // the user's selection
  29.     }
  30.  
  31.     if (!selectedBrowserItems) {   // on return, selectedBrowserItems stores
  32.     selectedBrowserItems =     // the user's selection
  33.         @("item2", "item4");
  34.     }
  35.  
  36.     if (!textFieldValue) {          // on return, textFieldValue stores the
  37.     textFieldValue =            // text the user entered 
  38.        @"Default text"; 
  39.     }
  40.  
  41.     if (!hiddenFieldValue) {
  42.     hiddenFieldValue = @"Secret Information";
  43.     }
  44.  
  45.     if (!passwordFieldValue) {    // WOPasswordField
  46.     passwordFieldValue = @"Default password";
  47.     }
  48.  
  49.     /* Text Value */
  50.     if (!textValue) {           // on return, textValue stores the
  51.     textValue =             // text the user entered in the WOText
  52.       @"Enter some text.";
  53.     }
  54. }
  55.  
  56. // Tell the WOBrowser that multiple selection is allowed.
  57. - multipleSelectionAllowedInBrowser {
  58.     return YES;
  59. }
  60.  
  61. // Send user's inputs to page 2
  62. - submitForm {
  63.     id aString;
  64.  
  65.     // A checked checked box returns a non-nil value.  To make it more 
  66.     // readable in Page 2, we'll set it to YES 
  67.     if (checkBoxChecked) checkBoxChecked = YES;
  68.     
  69.     // Create a string with the output of the elements in the form
  70.     aString = [NSString stringWithFormat:@"WOCheckBox=%@, 
  71.             WOPopUpButton=%@, WOBrowser=%@, WOTextField=%@, WOHiddenField=%@, 
  72.         WOPasswordField=%@, WOText=%@", checkBoxChecked, 
  73.         selectedPopUpButton, selectedBrowserItems, textFieldValue, 
  74.         hiddenFieldValue, passwordFieldValue, textValue];
  75.  
  76.     [WOApp setResultMessage:aString];
  77.     return [WOApp  pageWithName:@"Page2"];
  78. }
  79.  
  80.